﻿Imports Runa.Resources.ResourceManager
Imports Microsoft.Xna.Framework
Imports Microsoft.Xna.Framework.Graphics

Namespace Global.Runa.UI.Effects

    Public Class MaskEffect
        Inherits WpfEffectBase

        Private _Mask As Texture2DObject

        Public Sub New(ByVal g As Game)
            MyBase.New(g)
#If NETFX_CORE Then
            MyBase.Effect = New Effect(g.GraphicsDevice, Me._Content.LoadAllBytes("MaskEffect.mgfxo"))
#Else
            MyBase.Effect = Me._Content.Load(Of Effect)("MaskEffect.xnb")
#End If
        End Sub

        Public Overrides Sub UpdataParameters(ByVal Gametime As GameTime)
            'MyBase.Effect.Parameters.Item("Progress").SetValue(MyBase._Progress)
            'MyBase.Game.GraphicsDevice.Textures.Item(2) = Me._Mask.Texture
            'MyBase.Game.GraphicsDevice.SamplerStates.Item(2) = SamplerState.LinearClamp
            MyBase.UpdataParameters(Gametime)
        End Sub

        Public Property Mask As Texture2DObject
            Get
                Return Me._Mask
            End Get
            Set(ByVal value As Texture2DObject)
                If ((Not value.Texture Is Nothing) AndAlso (Not value Is Me._Mask)) Then
                    Me._Mask = value
                    MyBase.Effect.Parameters("Mask").SetValue(value.Texture)
                End If
            End Set
        End Property

    End Class

End Namespace